import { lazy } from "react"

const Home = lazy(() => import('@/pages/home/Home'))
const Index = lazy(() => import('@/pages/Index'))
const Login = lazy(() => import('@/pages/Login'))
const NotFount = lazy(() => import('@/pages/NotFount'))
const VisitorList = lazy(() => import('@/pages/visitor/VisitorLogList'))
const Visitoraddoredit = lazy(() => import('@/pages/visitor/VisitorAddOrEdit'))
const VisitorOptions = lazy(() => import('@/pages/visitor/VisitorOtions'))
const VisitorDesc = lazy(() => import('@/pages/visitor/VisitorDesc'))
interface Iroute {
    path: string
    element: React.ReactNode,
    meta?: {
        requiresAuth?: boolean,
        title: string,
        key?: string
    },
    children?: Array<Iroute>
}
export const routeList: Iroute[] = [
    {
        path: '/',
        element:<Login />,
        meta: {
            title: '登录',
        }
    },
    {
        path: '/index',
        element: <Index />,
        meta: {
            title: '首页',
            requiresAuth: true,
            key: '/index'
        },
        children: [
            {
                path: '',
                element: <Home />,
                meta: {
                    requiresAuth: true,
                    title: 'Home',
                    key: '/index'
                }
            },
            {
                path: '/index/home',
                element: <Home />,
                meta: {
                    requiresAuth: true,
                    title: '首页',
                    key: '/index/home'
                }
            }, 
        ]
    },
    {
        path: '/visitor',
        element: <Index />,
        meta: {
            requiresAuth: true,
            title: '访客记录',
            key: '/visitor'
        },
        children: [
            {
                path: '',
                element: <VisitorList />,
                meta: {
                    requiresAuth: true,
                    title: '访客列表',
                    key: '/visitor/list'
                }
            },
            {
                path: '/visitor/list',
                element: <VisitorList />,
                meta: {
                    requiresAuth: true,
                    title: '访客列表',
                    key: '/visitor/list'
                }
            },
           
            {
                path: '/visitor/addOrEdit',
                element: <Visitoraddoredit />,
                meta: {
                    requiresAuth: true,
                    title: '访客添加和修改',
                    key: '/visitor/addOrEdit'
                }
            },
            {
                path: '/visitor/options',
                element: <VisitorOptions />,
                meta: {
                    requiresAuth: true,
                    title: '负责人操作导入详细',
                    key: '/visitor/options'
                }
            },
        ]
    },
    {
        path: '/login',
        element: <Login />,
        meta: {
            title: '登录',
            key: 'login',
            // requiresAuth: false,
        }
    },
    {
        path: '*',
        element: <NotFount />,
        meta: {
            title: '404页面找不到',
        }
    }
]
